<?php
  header("Content-type:text/html;charset=utf-8");
  require_once('inc_flower.php');
 
  //连接数据库		
  connect();
  if(!empty($_FILES["ctf_pic"]["name"])){
    $pic = uploadfile('ctf_pic',UserPhotoPath,array('jpg','gif','png'));
  }
  else{
    $pic='';
  }
  $data = array(
		'ctf_title' => $_POST['ctf_title'], 
    'ctf_pic'=> $pic, 
		'ctf_place' => $_POST['ctf_place'],
		'ctf_intro' => $_POST['ctf_intro'],
		'ctf_adddate' => $_POST['ctf_adddate'],
		'ctf_hint' => $_POST['ctf_hint']
  	);

  //执行SQL语句
	$result = add('flower',$data);

  if(!$result){
  	echo "添加失败！<br/>";
  	echo "<a href='addflower.php'>返回</a>";	  
  }else{	  
 	redirect('flowerlist.php', '添加成功！'); 
  }    
  
?>